#include<iostream>
#include<string>
#include<vector>

using namespace std;

template<class T>
T Add(const T& left, const T& right)
{
	return left + right;
}

void test1()
{
	int a = 2, b = 4;
	double c = 2.1, d = 4.1;
	cout << Add(a, b) << endl;
	cout << Add((int)c, b) << endl;
	cout << Add<double>(c, b) << endl;
}

void test2()
{
	string s1;
	string s2("zhangshan");
	string s3("hello world");
	string s4(10, '*');
	string s5(s2);
	cout << s1 << endl << s2 << endl << s3 << endl << s4 << endl << s5 << endl;
	string s6(s3,6,5);
	cout << s6 << endl;
	string s7(s3, 6);
	cout << s7 << endl;
	string s8(s3, 6, 100);
	cout << s8 << endl;
}

void test3()
{
	string ur1("https://www.maysheeo.top/blog");
	string sub1(ur1, 0, 5);
	string sub2(ur1, 8, 16);
	string sub3(ur1, 25);
	cout << sub1 << endl << sub2 << endl << sub3;
}

void test4()
{
	string s1 = "hello";
	string s2 = s1;
	cout << s1 << endl << s2 << endl;
	s1 = '2';
	cout << s1 << endl;
	s1 += "B";
	cout << s1 << endl;
}

void test5()
{
	string s1 = "maysheeo";
	cout << s1.size() << endl;
	for (size_t i = 0; i < s1.size(); i++)
	{
		cout << s1[i] << " ";
	}
	cout << endl;
	for (auto ch : s1)
	{
		cout << ch << " ";
	}
	vector<int> v1;
	v1.push_back(1);
	v1.push_back(2);
	v1.push_back(3);
	vector<int>::iterator vit = v1.begin();
	while (vit != v1.end())
	{
		cout << *vit << " ";
		++vit;
	}
	cout << endl;
}

int main()
{
	test5();
	return 0;
}